<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        p{
           width: 500px;
           height: 50px;
           margin: 0 auto; 
        }
        #red{
            float: left;
            margin-left: 15px;
            width: 12px;
            height: 12px;
            background-color: red;
            border: 2px solid red;
           
        }
        #green{
            float: left;
            margin-left: 15px;
            width: 12px;
            height: 12px;
            background-color: green;
            border: 2px solid green;
        }
        #blke{
            float: left;
            margin-left: 15px;
            width: 12px;
            height: 12px;
            background-color: blue;
            border: 2px solid blue;
        }
        table{
            border: 1px solid green;
            
        }
        td{
            border: 1px solid green;
            /* background-color: aqua;s */
        }
    </style>
</head>
<body>
   <p>
       <div onclick="Rd()" id="red"></div>
       <div onclick="Gr()" id="green"></div>
       <div onclick="Bl()" id="blke"></div>
   </p>
    <table id="table" cellspacing="0">
        <tr>
            <td>体育</td>
            <td>音乐</td>
            <td>美术</td>
            <td>语文</td>
            <td>数学</td>
            <td>历史</td>
        </tr>
    </table>
    <script>

        function Rd(){
            document.getElementById('red').style.background = '#fff'
            document.getElementById('green').style.background = 'green'
            document.getElementById('blke').style.background = 'blue'
            document.body.style.background ='pink';
            document.getElementById('table').style.background = 'green';
        }
        function Gr(){
            document.getElementById('green').style.background = '#fff'
            document.getElementById('red').style.background = 'red'
            document.getElementById('blke').style.background = 'blue'
            document.body.style.background ='#000';
            document.getElementById('table').style.background = 'red';
        }
        function Bl(){
            document.getElementById('blke').style.background = '#fff'
            document.getElementById('green').style.background = 'green'
            document.getElementById('red').style.background = 'red'
            document.body.style.background ='yellow';
            document.getElementById('table').style.background = 'pink';
        }


    </script>
    
</body>
</html>